package cn.bjtu.archiprac.papercheck.application.vo;

import cn.bjtu.archiprac.papercheck.application.constant.Constants;
import cn.bjtu.archiprac.papercheck.application.model.User;

/**
 * Created by Zexin Lin on 4/13/2018.
 */
public class UserVO extends User{
    private Integer pageIndex = 1;
    private Integer pageSize = Constants.QueryParam.DEFAULT_PAGE_SIZE;
    private Integer start;
    private Integer end;

    public Integer getStart() {
        return start;
    }

    public Integer getEnd() {
        return end;
    }

    public Integer getPageIndex() {
        return pageIndex;
    }

    public void setPageIndex(Integer pageIndex) {
        this.pageIndex = pageIndex;
        updateRange();
    }

    public Integer getPageSize() {
        return pageSize;
    }

    public void setPageSize(Integer pageSize) {
        this.pageSize = pageSize;
        updateRange();
    }

    private void updateRange() {
        this.start = (pageIndex - 1) * pageSize;
        this.end = pageIndex * pageSize;
    }
}
